<?php
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
$_SESSION['forward_url']='jy_ylfee/index/';
cfc('core')->checklogin();
if($_RQ['op']=='main'){
	$member=$this->get('member',array('mid'=>$_SESSION['uid'],'uniacid'=>$_SESSION['uniacid']));
	$return['setting']=$this->plugin_setting('page_setting');
	$params=array('ispay'=>1,'uniacid'=>$_SESSION['uniacid']);
	if($_SESSION['uid']){
		$params['mid <>']=$_SESSION['uid'];
	}
	if(!$member['level_id']){
		$params['province']=$member['province'];
		$params['city']=$member['city'];
		$params['level_id']=0;
		$getgufee=pdo_getsum('jy_ylfee_apply',$params,'fee');
		$getgunum=pdo_count('jy_ylfee_apply',$params);
	}elseif($member['level_id']==1){
		$params['province']=$member['province'];
		$params['city']=$member['city'];
		$getgufee=pdo_getsum('jy_ylfee_apply',$params,'fee');
		$getgunum=pdo_count('jy_ylfee_apply',$params);
	}elseif($member['level_id']==2){
		$params['province']=$member['province'];
		$getgufee=pdo_getsum('jy_ylfee_apply',$params,'fee');
		$getgunum=pdo_count('jy_ylfee_apply',$params);
	}
	$data['levelfee']=$getgufee;
	$data['levelfeenum']=$getgunum;
	$return['data']=$data;
	$return['list']=array();
	exi($return);
}
if($_RQ['op']=='list'){
	$params=array('ispay'=>1,'uniacid'=>$_SESSION['uniacid']);
	if($_SESSION['uid']){
		$params['mid <>']=$_SESSION['uid'];
	}
	$member=$this->get('member',array('mid'=>$_SESSION['uid'],'uniacid'=>$_SESSION['uniacid']));
	if(!$member['level_id']){
		$params['province']=$member['province'];
		$params['city']=$member['city'];
		$params['level_id']=0;
	}elseif($member['level_id']==1){
		$params['province']=$member['province'];
		$params['city']=$member['city'];
	}elseif($member['level_id']==2){
		$params['province']=$member['province'];
	}
	$psize=20;
	$pindex=intval($_RQ['page'])?:1;
	$parameter=array(
		'params'=>$params,
		'limit'=>array($pindex,$psize),
		
	);
	$list=$this->get_list('apply',$parameter);
	if(!$list){
		exi('none');
	}
	foreach($list as &$item){
		$item['createtime']=date('Y-m-d H:i:s',$item['createtime']);
		$item['member']=model('core/member')->basic($item['mid']);
		$item['statustitle']=$this->agent_status[$item['status']];
		$item['leveltitle']=$this->level_types[$item['level_id']];
		$item['leveltitle']=$item['leveltitle']?:'默认等级';
	}
	exi($list);
}
?>